package net.zoneland.knowledge.dao;

import java.util.List;
import net.zoneland.knowledge.model.UserRoleRel;
import net.zoneland.knowledge.model.UserRoleRelExample;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface UserRoleRelMapper {
    @SelectProvider(type=UserRoleRelSqlProvider.class, method="countByExample")
    long countByExample(UserRoleRelExample example);

    @Insert({
        "insert into AITK_USER_ROLE_REL (ID, USERID, ",
        "ROLEID, CREATETIME, ",
        "RESTRAINT)",
        "values (#{id,jdbcType=VARCHAR}, #{userid,jdbcType=VARCHAR}, ",
        "#{roleid,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, ",
        "#{restraint,jdbcType=VARCHAR})"
    })
    int insert(UserRoleRel record);

    @InsertProvider(type=UserRoleRelSqlProvider.class, method="insertSelective")
    int insertSelective(UserRoleRel record);

    @SelectProvider(type=UserRoleRelSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR),
        @Result(column="USERID", property="userid", jdbcType=JdbcType.VARCHAR),
        @Result(column="ROLEID", property="roleid", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATETIME", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="RESTRAINT", property="restraint", jdbcType=JdbcType.VARCHAR)
    })
    List<UserRoleRel> selectByExample(UserRoleRelExample example);

    @UpdateProvider(type=UserRoleRelSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserRoleRel record, @Param("example") UserRoleRelExample example);

    @UpdateProvider(type=UserRoleRelSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserRoleRel record, @Param("example") UserRoleRelExample example);
}
